##############################################################
#Figure C1: Placebo Test: Distance from Future Hurricanes
##############################################################

data <- read.dta("./input/cces-subset.dta")

data$hur_wind_98 <- as.numeric(data$hur_wind_98)
data$hur_wind_99 <- as.numeric(data$hur_wind_99)

data$treat.hur.98 <- ifelse(data$hur_wind_98>=64, data$min_hur_dist_98, NA)
data$treat.hur.99 <- ifelse(data$hur_wind_99>=64, data$min_hur_dist_99, NA)

m2 <- lm(risk~factor(race_14) + factor(education) + female  + factor(income_quarters) + 
           employed + out_of_labour +  age + treat.hur.98 + treat.hur.99, data=data)

coefplot(m2, coefficients = c("treat.hur.98", "treat.hur.99"),
         newNames = c(treat.hur.98="Hurricane Matthew" , treat.hur.99="Hurricane Hermine"),
         zeroColor = "grey60", zeroType = 2, zeroLWD = 1, title=" ") + theme_bw() + 
  scale_color_manual(values=c("black","black"))  + 
  theme(legend.position="none") + 
  xlab("Effect of Future Hurricanes on 2014 Risk Aversion") + xlim(-0.002, 0.002) + ylab(" ")
ggsave("./figures/figc1.pdf")
